package com.bwie.controller;
import com.bwie.pojo.Type;
import com.bwie.service.Impl.TypeServiceImpl;
import com.bwie.service.TypeService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;

/**
* 商品分类表(tb_type)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/prod/type")
public class TypeController {
/**
* 服务对象
*/
    @Autowired
    private TypeService typeService;

    /**
     * 类型的树菜单
     * @param pageInfoVo
     * @return
     */
    @PostMapping(value = "getTypeList")
    public R getTypeList(
            @RequestBody PageInfoVo pageInfoVo
            ){
        return typeService.getTypeList(pageInfoVo);
    }

    /**
     * 添加类型
     * @param type
     * @return
     */
    @PostMapping(value = "addTypeList")
    public R addTypeList(
        @RequestBody Type type
    ){
        return typeService.addTypeList(type);
    }

    /**
     * 图片上传
     * @param file
     * @return
     */
    @PostMapping(value = "/uploadFile")
    public R uploadFile(
            @RequestPart("file")MultipartFile file
            ){
        return typeService.uploadFile(file);
    }

    /**
     * 商品分类树
     * @return
     */
    @PostMapping(value = "/getSelectTypeListTree")
    public R getSelectTypeListTree(){
        return typeService.getSelectTypeListTree();
    }
}